<script setup lang="ts">
/*
vue2  v-model
   <xxx v-model="fatherValue"     />
   <xxx :value="fatherValue"  @input="fatherValue=$event"   />
   xxx组件内
      props:['value']
      model:{
          prop:'value',
          event:'input'
      }
      this.$emit('input',修改后的值)
vue3 v-model
    <xxx v-model:modelValue="fatherValue"   v-model:abc="fatherValue"   />
    <xxx :modelValue="fatherValue"  @update:modelValue="fatherValue=$event"   />
    xxx组件内
      defineProps:{
          modelValue:{
              type:String
          }
      }
    const emits=defineEmits<{
          (e:'update:modelValue',str:string):void
      }>()
      emits('update:modelValue',修改后的值)

*/
defineProps({
  num: {
    type: Number,
    required: true
  }
})
const emits = defineEmits<{
  (e: 'update:num', xx: number): void
}>()
const setNum = () => {
  emits('update:num', Date.now())
}
</script>
<template>
  <div>我是子组件---{{ num }}</div>
  <button @click="setNum">修改num</button>
</template>
<style></style>
